package com.songlanyun.modules.account.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.songlanyun.modules.account.entity.UserShopRoleEntity;

import java.math.BigDecimal;
import java.util.List;

/**
 * 会员在每个店铺中的等级（会员的上级会员如查成为商家，自己的绑定店铺成为这个商家的店铺，同时之前所在商家的等级要克隆下来）
 *
 * @author Mark
 * @email sunlightcs@gmail.com
 * @date 2020-11-05 17:23:13
 */
public interface UserShopRoleService extends IService<UserShopRoleEntity> {


    /**
     * 更新某用户在某店铺中的会员等级
     *
     * @param userId
     * @param shopId
     * @param level
     */
    void updateLevelByUserAndShop(Long userId, Long shopId, Integer level);

    void saveByAccountAndShop(List<Long> accountList, Long subjectionShopId, Long shopId);

    /**
     * 根据条件查询会员等级设置
     *
     * @param entity
     * @return
     */
    List<UserShopRoleEntity> getList(UserShopRoleEntity entity);

    UserShopRoleEntity getUserShopRole(Long shopId, Long userId);

    UserShopRoleEntity updateAmount(Long userId, Long shopId, BigDecimal amount);

    /**
     * 根据等级初始化一条等级记录
     *
     * @param userId
     * @param shopId
     * @return
     */
    UserShopRoleEntity init(Long userId, Long shopId, Integer level, BigDecimal amount);

    BigDecimal getSumByUserId(Long userId);

    BigDecimal getSumByUserIdAndShopId(Long userId, Long shopId);

    void saveAndUpdateByIdsAndShop(List<Long> ids, Long subjectionShopId, Long shopId);

    void updateClass(Long shopId, Long userId, Integer level);
}

